#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>

int main()
{
	FILE* pfread = fopen("data.txt", "r");
	if (pfread == NULL)
	{
		perror("fopen-1");
		return 1;
	}
	char ch = 0;
	FILE* pfwrite = fopen("data_copy.txt", "w");
	if (pfwrite == NULL)
	{
		perror("fopen-2");
		fclose(pfwrite);
		pfwrite = NULL;
		return 1;
	}
	while ((ch = fgetc(pfread)) != EOF)
	{
		fputc(ch, pfwrite);
	}
	fclose(pfread);
	pfread = NULL;
	fclose(pfwrite);
	pfwrite = NULL;
	return 0;
}